export default {
  /** 导出，下载处理文件流
  * @method download
  * @param "{res：文件流，name ： 下载文件名}"
  */
  downloadFile: (res: any, name = '下载.zip') => {
    const content = res
    const blob = new Blob([content]);
    const fileName = name
    if ('download' in document.createElement('a')) { // 非IE下载
      const elink = document.createElement('a');
      elink.download = fileName;
      elink.style.display = 'none';
      elink.href = URL.createObjectURL(blob);
      document.body.appendChild(elink)
      elink.click()
      URL.revokeObjectURL(elink.href) // 释放URL 对象
      document.body.removeChild(elink)
    }
  }
}
